import { defHttp } from '/@/utils/http/axios';
import {
  delproductApiParams,
  editProductApiParams,
  getProductDetailApiParams,
  getProductListApiParams,
  saveProductApiParams,
} from '/@/api/sys/model/product';

enum Api {
  GetProductList = '/product/getProductList',
  Delproduct = '/product/deleteProductById',
  GetProductStatesList = '/product/getProductStatesList',
  GetProductDetail = '/product/getProductDetail',
  EditProduct = '/product/editProduct',
  SaveProduct = '/product/saveProduct',
  Upload = '/product/uploadFile',
}

export const getProductList = (params: getProductListApiParams) => {
  return defHttp.post({ url: Api.GetProductList, params });
};
export const delproduct = (params: delproductApiParams) => {
  return defHttp.get({ url: Api.Delproduct, params });
};
export const getProductStatesList = () => {
  return defHttp.get({ url: Api.GetProductStatesList });
};
export const getProductDetail = (params: getProductDetailApiParams) => {
  return defHttp.get({ url: Api.GetProductDetail, params });
};
export const editProduct = (params: editProductApiParams) => {
  return defHttp.post({ url: Api.EditProduct, params });
};
export const saveProduct = (params: saveProductApiParams) => {
  return defHttp.post({ url: Api.SaveProduct, params });
};
export const uploadFile = (params: FormData) => {
  return defHttp.post({ url: Api.Upload, params });
};
